All Questions
11 questions
1vote
1answer
276views
Speeding up naive backtracking Sudoku Solver in Haskell
After watching a recent computerphile video on building a very simple sudoku solver I tried to implement the same in Haskell. From this CR question I learned that it is probably a better idea to use ...
3votes
1answer
134views
Monoidal tree interview in Haskell
I was working on the following interview question: Given an array of integers, return a new array such that each element at index i of the new array is the ...
3votes
0answers
207views
Sudoku solver in Haskell using Reader+ST
While trying to understand monad transformers in Haskell I came up with a sudoku solver based on a combination of the ST and Reader monad. I am positively surprised with the performance, however ...
2votes
1answer
111views
HashCash Algorithm header generation in Haskell
A thought exercise on my part as I'm relatively new to Haskell. I wanted an interesting project to work on so I decided to implement the Hashcash Algorithm, which is most commonly used as the basis of ...
6votes
2answers
257views
Imperative Sieve of Eratosthenes using destructive updates in Haskell
I've implemented the prime sieve of Eratosthenes in Haskell using a mutable array of unboxed Bools instead of the usual pure and immutable datastructures. My main concern with this code is speed. For ...
5votes
2answers
148views
Function that produces \$a^nb^nc^n\$
I'm trying to write a function that produces an infinite list containing strings of the form \$a^nb^nc^n\$. My first idea was to do it using comprehensions. ...
1vote
2answers
300views
Brotli compression algorithm, translated from Python into Haskell
I have converted some code in Python into its Haskell equivalent. Python implementation: ...
3votes
3answers
355views
Efficient Collatz sequence analysis
I'm new to Haskell, and I'm wondering why my programs are so slow compared to other languages. Haskell, 6 seconds (x64, -O2): ...
3votes
1answer
209views
Space and time complexity of operation on lists
I'm new to programming and even more new to Haskell. Below is a little tid-bit I wrote that operates on a bunch of lists. I am wondering if someone would be kind enough to walk through the function <...
7votes
4answers
856views
Finding the sum of all the multiples of 3 or 5 below 1000, using list comprehension
I'm trying to compare my own implementation with another solution of Project Euler problem #1, which uses a list comprehension: ...
10votes
1answer
548views
Graph generator for undirected graphs
I am still pretty new to Haskell and am working on a graph generator for undirected unlabeled graphs containing loops and I have a bottleneck in the following functions. So far, I have not given any ...